﻿/// <reference path="../Jquery/jquery-1.5.2.min.js" />
/// <reference path="../Jquery/jquery-ui.js" />

(function ($) {

    $.fn.form = function (options) {

        // -- Default settings --
        var settings = $.extend({
        }, options || {});
        
        // -- Input decoration on blur and focus --
        $(".form-input-string input")
        .live("focus", function () {
            if (!$(this).parent().parent().hasClass("form-focus"))
                $(this).parent().parent().addClass("form-focus");
        })
        .live("blur", function () {
            if ($(this).parent().parent().hasClass("form-focus"))
                $(this).parent().parent().removeClass("form-focus");
        });

        // -- Set the error message in window tooltip --
        $(this).delegate(".tooltip-content", "mouseenter", function () {

            $(this).next(".tooltip-window").css("visibility", "hidden");

            $(".window-content-content", $(this).next(".tooltip-window")).html(
                $(this).children(".field-validation-error").html()
            );
            $(this).next(".tooltip-window").css("visibility", "hidden");

            $(this).next(".tooltip-window").css("visibility", "visible");

        });
        return this;
    };
})(jQuery);